using System.Windows.Media;
using System.Windows.Media.Imaging;
using Common;
using Common.NotifyEvent;

namespace ProjectView.ProjectControls
{
	public class AQTargetDataRow : NotifyPropertyChanged
	{
		private object _ColumnItem = "";

		private object _Channel1 = "";

		private object _Channel2 = "";

		private object _Channel3 = "";

		private object _Channel4 = "";

		private object _Channel5 = "";

		private object _Channel6 = "";

		private object _Channel7 = "";

		private object _Channel8 = "";

		private Color _Color1 = Colors.Black;

		private Color _Color2 = Colors.Black;

		private Color _Color3 = Colors.Black;

		private Color _Color4 = Colors.Black;

		private Color _Color5 = Colors.Black;

		private Color _Color6 = Colors.Black;

		private Color _Color7 = Colors.Black;

		private Color _Color8 = Colors.Black;

		private int _TubeNo;

		private int _TargetIndex = 1;

		private BitmapImage _image1;

		private BitmapImage _image2;

		private BitmapImage _image3;

		private BitmapImage _image4;

		private BitmapImage _image5;

		private BitmapImage _image6;

		private BitmapImage _image7;

		private BitmapImage _image8;

		public object ColumnItem
		{
			get
			{
				return _ColumnItem;
			}
			set
			{
				if (value == null)
				{
					_ColumnItem = "";
				}
				else
				{
					_ColumnItem = value;
				}
				OnPropertyChanged("ColumnItem");
			}
		}

		public object Channel1
		{
			get
			{
				return _Channel1;
			}
			set
			{
				if (value == null)
				{
					_Channel1 = "";
				}
				else
				{
					_Channel1 = value;
				}
				OnPropertyChanged("Channel1");
			}
		}

		public object Channel2
		{
			get
			{
				return _Channel2;
			}
			set
			{
				if (value == null)
				{
					_Channel2 = "";
				}
				else
				{
					_Channel2 = value;
				}
				OnPropertyChanged("Channel2");
			}
		}

		public object Channel3
		{
			get
			{
				return _Channel3;
			}
			set
			{
				if (value == null)
				{
					_Channel3 = "";
				}
				else
				{
					_Channel3 = value;
				}
				OnPropertyChanged("Channel3");
			}
		}

		public object Channel4
		{
			get
			{
				return _Channel4;
			}
			set
			{
				if (value == null)
				{
					_Channel4 = "";
				}
				else
				{
					_Channel4 = value;
				}
				OnPropertyChanged("Channel4");
			}
		}

		public object Channel5
		{
			get
			{
				return _Channel5;
			}
			set
			{
				if (value == null)
				{
					_Channel5 = "";
				}
				else
				{
					_Channel5 = value;
				}
				OnPropertyChanged("Channel5");
			}
		}

		public object Channel6
		{
			get
			{
				return _Channel6;
			}
			set
			{
				if (value == null)
				{
					_Channel6 = "";
				}
				else
				{
					_Channel6 = value;
				}
				OnPropertyChanged("Channel6");
			}
		}

		public object Channel7
		{
			get
			{
				return _Channel7;
			}
			set
			{
				if (value == null)
				{
					_Channel7 = "";
				}
				else
				{
					_Channel7 = value;
				}
				OnPropertyChanged("Channel7");
			}
		}

		public object Channel8
		{
			get
			{
				return _Channel8;
			}
			set
			{
				if (value == null)
				{
					_Channel8 = "";
				}
				else
				{
					_Channel8 = value;
				}
				OnPropertyChanged("Channel8");
			}
		}

		public Color Color1
		{
			get
			{
				return _Color1;
			}
			set
			{
				if (!(_Color1 == value))
				{
					_Color1 = value;
					OnPropertyChanged("Color1");
				}
			}
		}

		public Color Color2
		{
			get
			{
				return _Color2;
			}
			set
			{
				if (!(_Color2 == value))
				{
					_Color2 = value;
					OnPropertyChanged("Color2");
				}
			}
		}

		public Color Color3
		{
			get
			{
				return _Color3;
			}
			set
			{
				if (!(_Color3 == value))
				{
					_Color3 = value;
					OnPropertyChanged("Color3");
				}
			}
		}

		public Color Color4
		{
			get
			{
				return _Color4;
			}
			set
			{
				if (!(_Color4 == value))
				{
					_Color4 = value;
					OnPropertyChanged("Color4");
				}
			}
		}

		public Color Color5
		{
			get
			{
				return _Color5;
			}
			set
			{
				if (!(_Color5 == value))
				{
					_Color5 = value;
					OnPropertyChanged("Color5");
				}
			}
		}

		public Color Color6
		{
			get
			{
				return _Color6;
			}
			set
			{
				if (!(_Color6 == value))
				{
					_Color6 = value;
					OnPropertyChanged("Color6");
				}
			}
		}

		public Color Color7
		{
			get
			{
				return _Color7;
			}
			set
			{
				if (!(_Color7 == value))
				{
					_Color7 = value;
					OnPropertyChanged("Color7");
				}
			}
		}

		public Color Color8
		{
			get
			{
				return _Color8;
			}
			set
			{
				if (!(_Color8 == value))
				{
					_Color8 = value;
					OnPropertyChanged("Color8");
				}
			}
		}

		public int TubeNo
		{
			get
			{
				return _TubeNo;
			}
			set
			{
				if (_TubeNo != value)
				{
					_TubeNo = value;
					for (int i = 1; i <= 8; i++)
					{
						SetColor(i, Utility.GetTargetColor(_TubeNo, i));
					}
				}
			}
		}

		public int TargetIndex
		{
			get
			{
				return _TargetIndex;
			}
			set
			{
				if (_TargetIndex != value)
				{
					_TargetIndex = value;
				}
			}
		}

		public BitmapImage Image1
		{
			get
			{
				return _image1;
			}
			set
			{
				if (_image1 != value)
				{
					_image1 = value;
					OnPropertyChanged("Image1");
				}
			}
		}

		public BitmapImage Image2
		{
			get
			{
				return _image2;
			}
			set
			{
				if (_image2 != value)
				{
					_image2 = value;
					OnPropertyChanged("Image2");
				}
			}
		}

		public BitmapImage Image3
		{
			get
			{
				return _image3;
			}
			set
			{
				if (_image3 != value)
				{
					_image3 = value;
					OnPropertyChanged("Image3");
				}
			}
		}

		public BitmapImage Image4
		{
			get
			{
				return _image4;
			}
			set
			{
				if (_image4 != value)
				{
					_image4 = value;
					OnPropertyChanged("Image4");
				}
			}
		}

		public BitmapImage Image5
		{
			get
			{
				return _image5;
			}
			set
			{
				if (_image5 != value)
				{
					_image5 = value;
					OnPropertyChanged("Image5");
				}
			}
		}

		public BitmapImage Image6
		{
			get
			{
				return _image6;
			}
			set
			{
				if (_image6 != value)
				{
					_image6 = value;
					OnPropertyChanged("Image6");
				}
			}
		}

		public BitmapImage Image7
		{
			get
			{
				return _image7;
			}
			set
			{
				if (_image7 != value)
				{
					_image7 = value;
					OnPropertyChanged("Image7");
				}
			}
		}

		public BitmapImage Image8
		{
			get
			{
				return _image8;
			}
			set
			{
				if (_image8 != value)
				{
					_image8 = value;
					OnPropertyChanged("Image8");
				}
			}
		}

		public byte[] BImage1 { get; set; }

		public byte[] BImage2 { get; set; }

		public byte[] BImage3 { get; set; }

		public byte[] BImage4 { get; set; }

		public byte[] BImage5 { get; set; }

		public byte[] BImage6 { get; set; }

		public byte[] BImage7 { get; set; }

		public byte[] BImage8 { get; set; }

		public AQTargetDataRow()
		{
		}

		public AQTargetDataRow(object objItem)
		{
			_ColumnItem = objItem;
		}

		public object GetObject(int idx)
		{
			switch (idx)
			{
			case 1:
				return Channel1;
			case 2:
				return Channel2;
			case 3:
				return Channel3;
			case 4:
				return Channel4;
			case 5:
				return Channel5;
			case 6:
				return Channel6;
			case 7:
				return Channel7;
			case 8:
				return Channel8;
			default:
				return ColumnItem;
			}
		}

		public void SetValue(int idx, object obj)
		{
			switch (idx)
			{
			case 1:
				Channel1 = obj;
				break;
			case 2:
				Channel2 = obj;
				break;
			case 3:
				Channel3 = obj;
				break;
			case 4:
				Channel4 = obj;
				break;
			case 5:
				Channel5 = obj;
				break;
			case 6:
				Channel6 = obj;
				break;
			case 7:
				Channel7 = obj;
				break;
			case 8:
				Channel8 = obj;
				break;
			default:
				ColumnItem = obj;
				break;
			}
		}

		public Color GetColor(int idx)
		{
			switch (idx)
			{
			case 1:
				return Color1;
			case 2:
				return Color2;
			case 3:
				return Color3;
			case 4:
				return Color4;
			case 5:
				return Color5;
			case 6:
				return Color6;
			case 7:
				return Color7;
			case 8:
				return Color8;
			default:
				return Color1;
			}
		}

		public void SetColor(int idx, Color color)
		{
			switch (idx)
			{
			case 1:
				Color1 = color;
				break;
			case 2:
				Color2 = color;
				break;
			case 3:
				Color3 = color;
				break;
			case 4:
				Color4 = color;
				break;
			case 5:
				Color5 = color;
				break;
			case 6:
				Color6 = color;
				break;
			case 7:
				Color7 = color;
				break;
			case 8:
				Color8 = color;
				break;
			}
		}

		public AQTargetDataRow(object obj0, object obj1, object obj2, object obj3, object obj4, object obj5, object obj6, object obj7, object obj8)
		{
			_ColumnItem = obj0;
			_Channel1 = obj1;
			_Channel2 = obj2;
			_Channel3 = obj3;
			_Channel4 = obj4;
			_Channel5 = obj5;
			_Channel6 = obj6;
			_Channel7 = obj7;
			_Channel8 = obj8;
		}

		public void SetImage(int idx, BitmapImage image, byte[] bytes)
		{
			switch (idx)
			{
			case 1:
				Image1 = image;
				BImage1 = bytes;
				break;
			case 2:
				Image2 = image;
				BImage2 = bytes;
				break;
			case 3:
				Image3 = image;
				BImage3 = bytes;
				break;
			case 4:
				Image4 = image;
				BImage4 = bytes;
				break;
			case 5:
				Image5 = image;
				BImage5 = bytes;
				break;
			case 6:
				Image6 = image;
				BImage6 = bytes;
				break;
			case 7:
				Image7 = image;
				BImage7 = bytes;
				break;
			case 8:
				Image8 = image;
				BImage8 = bytes;
				break;
			}
		}

		public BitmapImage GetImage(int idx)
		{
			switch (idx)
			{
			case 1:
				return Image1;
			case 2:
				return Image2;
			case 3:
				return Image3;
			case 4:
				return Image4;
			case 5:
				return Image5;
			case 6:
				return Image6;
			case 7:
				return Image7;
			case 8:
				return Image8;
			default:
				return Image1;
			}
		}

		public byte[] GetImageBytes(int idx)
		{
			switch (idx)
			{
			case 1:
				return BImage1;
			case 2:
				return BImage2;
			case 3:
				return BImage3;
			case 4:
				return BImage4;
			case 5:
				return BImage5;
			case 6:
				return BImage6;
			case 7:
				return BImage7;
			case 8:
				return BImage8;
			default:
				return BImage1;
			}
		}

		public void RemoveImage(int idx)
		{
			switch (idx)
			{
			case 1:
				Image1 = null;
				BImage1 = new byte[0];
				break;
			case 2:
				Image2 = null;
				BImage2 = new byte[0];
				break;
			case 3:
				Image3 = null;
				BImage3 = new byte[0];
				break;
			case 4:
				Image4 = null;
				BImage4 = new byte[0];
				break;
			case 5:
				Image5 = null;
				BImage5 = new byte[0];
				break;
			case 6:
				Image6 = null;
				BImage6 = new byte[0];
				break;
			case 7:
				Image7 = null;
				BImage7 = new byte[0];
				break;
			case 8:
				Image8 = null;
				BImage8 = new byte[0];
				break;
			}
		}
	}
}
